<template>
	<view class="container">
		<view class="head"></view>
		<view class="body flex-c">
			<view class="button flex-r" v-if="platform=='ios'||platform=='windows'" @tap="downClick(1)">
				<image src="@/public/images/public/iphone.png" mode="aspectFit"></image>
				<text space="ensp">iphone 下载</text>
			</view>
			<view v-if="platform=='android'||platform=='windows'" class="button flex-r" @tap="downClick(2)">
				<image src="@/public/images/public/Android.png" mode="aspectFit"></image>
				<text space="ensp">Android 下载</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		onLoad() {
			let ua = navigator.userAgent.toLowerCase();
			this.iphone = /(iphone|ipad|mac|ios)/i.test(ua)
			console.log(this.platform,'=')
			/* 
			if(ua.match(/micromessenger/i) != "micromessenger"){
				if(iphone) {
					//ios的scheme协议
					//window.location.href = 'rainbowphysicaluser://'
				}else{
					//安卓app的scheme协议
					//window.location.href = 'chtyuser://';
				}
				setTimeout(()=>{
					let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||window.document.webkitHidden 
					if(typeof hidden =="undefined" || hidden ==false){
						this.$CHS.downApp()
					}
				}, 3000);
			}*/
		},
		methods: {
			downClick(type) {
				let ua = navigator.userAgent.toLowerCase();
				if(ua.match(/micromessenger/i) != "micromessenger"){
					if(!this.iphone && type == 1){
						uni.showToast({
							title: '当前设备系统不支持',
							icon: 'none'
						})
					}
				}
				this.$CHS.downApp(type)
			}
		}
	}
</script>

<style lang="scss">
	.container{
		padding: 0;
		min-height: var(--safe-height);
		background: #0055FF;
		.head{
			max-width: $max-width;
			width: 100%;
			height: 934rpx;
			background-image: url("~@/public/images/public/tu (1).png");
			background-repeat: no-repeat;
			background-size: 100%;
			background-position: 0 -30rpx;
		}
		.body{
			max-width: $max-width;
			margin-top: 30rpx;
			padding-bottom: 30rpx;
			align-items: center;
			.button{
				width: 560rpx;
				height: 120rpx;
				border: 2rpx solid #FFFFFF;
				border-radius: 60rpx;
				align-items: center;
				justify-content: center;
				font-size: 36rpx;
				line-height: 49rpx;
				color: #FFFFFF;
				image{
					width: 48rpx;
					height: 49rpx;
					margin-right: 30rpx;
				}
				margin-bottom: 40rpx;
			}
		}
	}

</style>
